/*
 * Copyright 2013-2019 Xia Jun(3979434@qq.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ***************************************************************************************
 *                                                                                     *
 *                        Website : http://www.farsunset.com                           *
 *                                                                                     *
 ***************************************************************************************
 */
package com.workcell.workdata.im.component.cim.handler;

import com.farsunset.cim.constant.ChannelAttr;
import com.farsunset.cim.group.TagSessionGroup;
import com.farsunset.cim.handler.CIMRequestHandler;
import com.farsunset.cim.model.SentBody;
import com.workcell.workdata.im.component.cim.handler.annotation.CIMHandler;
import io.netty.channel.Channel;

import javax.annotation.Resource;

/**
 * 取消订阅到一个tag，多人通话，长连接离开房间
 */
@CIMHandler(key = "client_remove_tag")
public class CleanTagHandler implements CIMRequestHandler {

	@Resource
	private TagSessionGroup tagSessionGroup;

	@Override
	public void process(Channel channel, SentBody body) {

		tagSessionGroup.remove(channel);

		channel.attr(ChannelAttr.TAG).set(null);
	}
}
